package com.scnu.common.utils;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;

import java.util.List;

public class TagsUtils {
    public static String CovertTagsToString(List<String> tags){
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[");
        for (String tag : tags) {
            stringBuilder.append(tag).append(",");
        }
        stringBuilder.deleteCharAt(stringBuilder.length()-1);
        stringBuilder.append("]");
        return stringBuilder.toString();

    }

    public static List<String> CovertTagsFromString(String tags){
        JSONArray objects = JSONUtil.parseArray(tags);
        return objects.toList(String.class);
    }



}
